package com.boco.dal.jmx.demo.config;

import javax.management.MBeanServer;
import javax.management.MBeanServerFactory;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;

import com.sun.jdmk.comm.HtmlAdaptorServer;

public class AppConfig {

	/**
	 * @param args
	 * @throws NullPointerException 
	 * @throws MalformedObjectNameException 
	 */
	public static void main(String[] args) throws Exception {
		ObjectName configName = new ObjectName("config:name=ConfigDemo");
		ObjectName adapterName = new ObjectName("MqInfoAgent:name=htmladapter,port=8082");
		HtmlAdaptorServer adapter = new HtmlAdaptorServer();
		
		MBeanServer server = MBeanServerFactory.createMBeanServer();
		MqInfo mq = new MqInfo();
		server.registerMBean(mq, configName);
		server.registerMBean(adapter, adapterName);
		
		adapter.start();
		System.out.println("start.....");
		
		ConfigPool config = new ConfigPool();
		config.setMq(mq);
		config.start();
		
	}

}
